module.exports = `
  type Task {
    id: ID!
    type: String
    name: String
    totalSubmitted: Int
    userCount: Int
    finishCount: Int
    expireAt: String
    expireAtISO: String
    prePublishAt: String
    isPublished: Int
    createdAt: String
    updatedAt: String
    documentId: Int
    versionId: Int
    creator: User
    document: Document
    groupId: Int
    group: Group
    user: User
    progresses: [Progress]
    unreadCount: Int
    isExpired: Boolean
  }

  type PageModalTask implements Page {
    totalCount: Int
    hasMore: Boolean
    totalPages: Int
    pageIndex: Int
    pageSize: Int
    rows: [Task]
  }

  type TaskPage {
    page: PageInfo!
    rows: [Task!]
  }

  extend type Query {
    # 通过ID获取 作业(任务)
    task(id: ID!): Task

    # 列出文档生成的作业列表
    documentTasks(documentId: ID, pageIndex: Int = 0, pageSize: Int = 20): PageModalTask

    # 根据ids获取task列表数据
    taskGetAllByIds(taskIds: [Int!]!): [Task!]

    # 获取我创建的作业
    taskGetMyCreates(filter: JSON, currentPage: Int, pageSize: Int): TaskPage!

    # 获取我创建的作业
    assignment(id: Int!): Task

    # 获取我的未处理任务数
    taskGetMyUnreadCount: Int!
  }

  extend type Mutation {
    # 客户端利用分享链接中的documentId，通过文档(题目)创建作业(任务)
    # 指定groupId或取token的userId，避免重复创建作业
    findOrCreateTask(documentId: ID!, groupId: ID): Task
    # 发送服务消息给未完成作业的用户
    urgeTask(taskId: ID!): [User]
    # 删除作业或任务
    # removeTask(id: ID!): Task

    # 修改任务
    taskModify(taskId: Int!, endAt: String, prePublishAt: String): Task
  }

`
